//---------------------------------------------------------------------------

#ifndef auxListH
#define auxListH
#include <iostream.h>
#include <list>
using namespace std;
//---------------------------------------------------------------------------

/*
Toda la maniana para descubrir esto:
http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12
*/

template <typename Type> class auxList {
private:
        list<Type> l;
public:
        int auxList<Type>::getSize() {
                return l.size();
        };

        Type auxList<Type>::getElement(int i) {
                list<Type>::iterator it = l.begin();
                for (int j=1; j<i; j++) it++;
                return (Type)*it;
        };

        Type auxList<Type>::getLastElement() {
                list<Type>::iterator it = l.end();
                it--;
                return (Type)*it;
        };

        void auxList<Type>::add(Type t) {
                l.push_back(t);
        };

        ~auxList() {
                list<Type>::iterator it = l.begin();
                for (int i=1; it!=l.end(); i++) {
                        delete *it;
                        it++;
                }
        };

        list<Type>::iterator getIterator() {
                return l.begin();
        };

        void auxList<Type>::removeItem(Type t) {
                l.remove(t);
        };
};

//---------------------------------------------------------------------------
#endif
